#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;

/*思考

*/

string gaojingsub(string s1, string s2) {
    int len1 = s1.size();
    int len2 = s2.size();
    int flag=0;
    if (len1 < len2 || len1 == len2 && s1 < s2) {
        flag=1;
        swap(s1, s2);
        swap(len1, len2);
    }

    int len3 = len1;
    // 逆序存储
    reverse(s1.begin(), s1.end());
    reverse(s2.begin(), s2.end());

    // 补齐短串
    while (s2.size() < len3) s2 += '0';

    string s3(len3 + 1, '0');

    // 逐位相减，借位处理
    for (int i = 0; i < len3; i++) {
        int digit1 = s1[i] - '0';
        int digit2 = s2[i] - '0';

        // 借位
        if (digit1 < digit2) {
            // 向更高位借 1
            int j = i + 1;
            while (j < len3 && s1[j] == '0') {
                s1[j] = '9';  // 0借后变9
                j++;
            }
            s1[j] = ((s1[j] - '0') - 1) + '0';

            digit1 += 10;
        }
        s3[i] = (digit1 - digit2) + '0';
    }

    // 去除末尾多余0
    while (s3.size() > 1 && s3.back() == '0') {
        s3.pop_back();
    }
    if (flag) {
        s3.push_back('-');
    }
    reverse(s3.begin(), s3.end());
    return s3;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s1, s2;
    cin >> s1 >> s2;
    cout << gaojingsub(s1, s2) << endl;
    return 0;
}